//
//  ThCharacterDocumentController.m
//  Thanatos
//
//  Created by Joel Owens on 5/12/10.
//  Copyright 2010 Na'Shenassi.org. All rights reserved.
//

#import "ThCharacterDocumentController.h"

@implementation ThCharacterDocumentController

@synthesize character;

- (ThCharacterDocumentController *)initWithThCharacter:(ThCharacter *)aCharacter {
  if (self = [super initWithWindowNibName:@"CharacterDocument"] ) {   
    character = aCharacter;
    tabs = [NSMutableDictionary dictionaryWithCapacity:1];
    [[self window] setFrameAutosaveName:[character name]];
    [[self window] makeKeyAndOrderFront:self];
    [imageViewForCharacterImageRepresentation bind:@"value"
                                          toObject:character
                                       withKeyPath:@"imageRepresentation"
                                           options:NULL];
    [detailsTab setBackgroundColor:[NSColor colorWithRed:93 
                                                   green:14
                                                    blue:18 
                                                   alpha:65 
                                    ]];
    [detailsTab setHighlightColor:[NSColor colorWithRed:79 
                                                  green:76 
                                                   blue:77 
                                                  alpha:100
                                   ]];
    [informationTab setBackgroundColor:[NSColor colorWithRed:93 
                                                   green:14
                                                    blue:18 
                                                   alpha:65 
                                    ]];
    [informationTab setHighlightColor:[NSColor colorWithRed:79 
                                                  green:76 
                                                   blue:77 
                                                  alpha:100
                                   ]];
    [journalTab setBackgroundColor:[NSColor colorWithRed:93 
                                                   green:14
                                                    blue:18 
                                                   alpha:65 
                                    ]];
    [journalTab setHighlightColor:[NSColor colorWithRed:79 
                                                  green:76 
                                                   blue:77 
                                                  alpha:100
                                   ]];
    [summaryTab setBackgroundColor:[NSColor colorWithRed:93 
                                                   green:14
                                                    blue:18 
                                                   alpha:65 
                                    ]];
    [summaryTab setHighlightColor:[NSColor colorWithRed:79 
                                                  green:76 
                                                   blue:77 
                                                  alpha:100
                                   ]];
    
  }
  return self;
}

- (void)awakeFromNib {
}  

- (void)windowShouldClose:(id)sender {
  [[NSApp delegate] closingWindow:[[[character objectID] URIRepresentation] absoluteString]];
  return YES;
}

@end
